package org.sensation.server.operation.management;

import org.apache.commons.pool.BasePoolableObjectFactory;
import org.apache.commons.pool.ObjectPool;
import org.apache.commons.pool.PoolableObjectFactory;
import org.apache.commons.pool.impl.GenericObjectPool;

public class WatingNumberMachine {
	private static final ObjectPool POOL;
	
	static{
		PoolableObjectFactory factory = new BasePoolableObjectFactory() {
			int seq=0;
			@Override
			public Object makeObject() throws Exception {
				return seq++;
			}
		};
		POOL = new  GenericObjectPool(factory);
	}
	public static Integer getSeqID() throws Exception{
		return (Integer) POOL.borrowObject();
	}
	public static void returnSeqID(Integer seqID) throws Exception{
		POOL.returnObject(seqID);
	}
}
